package com.prs.crm.action.stock.flow;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
import org.courser.ui.PaginationSupport;
import org.springframework.beans.factory.annotation.Autowired;

import com.prs.crm.action.FlowAction;
import com.prs.crm.annotation.Clew;
import com.prs.crm.context.AppContext;
import com.prs.crm.domain.store.StoreIn;
import com.prs.crm.domain.store.StoreOut;
import com.prs.crm.service.stock.StoreInService;
import com.prs.crm.service.stock.StoreOutService;


public class StoreOutFlowAction extends FlowAction<StoreOut> {

	private StoreOut storeout;

	@Autowired
	private StoreOutService storeOutnService;
	
	private PaginationSupport pagination;

	
	
	
	@Action("listStoreOutFlow")
	public String listStoreOutFlow() {
		pagination = this.getPaginationHelper().prepare(pagination);
		pagination = this.getStoreOutnService().listFlowTask(StoreOut.class, pagination, AppContext.getAccountContext().currentUser());

		return SUCCESS;
	}
	
	@Action("editStoreOutFlow")
	public String editStoreOutFlow() {
		this.displayEndNodes();		
		return SUCCESS;
	}
	
	@Clew(results={"success"})
	@Action(value="submitStoreOutFlow",results={@Result(name="success",type="redirect",location="listStoreOutFlow")})
	public String submitStoreOutFlow() {
		this.getStoreOutnService().execute(this.getNode(), this.getDetail(), storeout, AppContext.getAccountContext().currentUser());
		this.setPrompt("提交成功");
		return SUCCESS;
	}	
	

	public StoreOut getStoreout() {
		return storeout;
	}

	public void setStoreout(StoreOut storeout) {
		this.storeout = storeout;
	}

	public StoreOutService getStoreOutnService() {
		return storeOutnService;
	}

	public void setStoreOutnService(StoreOutService storeOutnService) {
		this.storeOutnService = storeOutnService;
	}

	public PaginationSupport getPagination() {
		return pagination;
	}

	public void setPagination(PaginationSupport pagination) {
		this.pagination = pagination;
	}
	
	
	
	
	
}
